﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using eBay.Service.Core.Soap;

namespace eBayBus.Block
{
    public class ShipBlock
    {
        public static Dictionary<string, string> _ShipBlocks = new Dictionary<string, string>();

                public ShipBlock()
        {
            Init();
        }

        private static void Init()
        {
            if (_ShipBlocks.Keys.Count > 0) return;


            _ShipBlocks.Add("US_SHANGHAI_D(0)_I(0)", "US_SHANGHAI_D(0)_I(0)");
            _ShipBlocks.Add("US_SHANGHAI_D(2)_I(2)", "US_SHANGHAI_D(2)_I(2)");

            _ShipBlocks.Add("UK_SHANGHAI_D(0)_I(0)", "UK_SHANGHAI_D(0)_I(0)");
            _ShipBlocks.Add("UK_SHANGHAI_D(2)_I(2)", "UK_SHANGHAI_D(2)_I(2)");

        }

        public static Dictionary<string, string> GetAll()
        {
            Init();
            return _ShipBlocks;
        }

        public static void SetBlock(string key, ItemType i1)
        {
            ShippingDetailsType shippingDetails;
            ShippingServiceOptionsType st1;
            InternationalShippingServiceOptionsType st2;

            switch (key)
            {
                case "US_SHANGHAI_D(0)_I(0)":

                    #region US_SHANGHAI_D(0)_I(0)

                    shippingDetails = new ShippingDetailsType(); ;

                    shippingDetails.ShippingType = ShippingTypeCodeType.Flat;
                    shippingDetails.ShippingTypeSpecified = true;
                    shippingDetails.ShippingRateTypeSpecified = true;

                    shippingDetails.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection();
                    shippingDetails.InternationalShippingServiceOption = new InternationalShippingServiceOptionsTypeCollection();

                    #region Domestic 1
                    st1 = new ShippingServiceOptionsType();
                    st1.ShippingService = "EconomyShippingFromOutsideUS";

                    st1.ShippingServiceCost = new AmountType();
                    st1.ShippingServiceCost.currencyID = CurrencyCodeType.USD;
                    st1.ShippingServiceCost.Value = 0;
                    st1.FreeShipping = true;
                    st1.FreeShippingSpecified = true;

                    st1.ShippingServiceAdditionalCost = new AmountType();
                    st1.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.USD;
                    st1.ShippingServiceAdditionalCost.Value = 0;

                    st1.ShippingInsuranceCost = new AmountType();
                    st1.ShippingInsuranceCost.Value = 0;
                    st1.ShippingInsuranceCost.currencyID = CurrencyCodeType.USD;

                    st1.ShippingServicePriority = 0;
                    shippingDetails.ShippingServiceOptions.Add(st1);

                    InsuranceDetailsType InsuranceDetails = new InsuranceDetailsType();
                    InsuranceDetails.InsuranceFee = new AmountType();
                    InsuranceDetails.InsuranceFee.currencyID = CurrencyCodeType.USD;
                    InsuranceDetails.InsuranceFee.Value = 0;
                    InsuranceDetails.InsuranceOption = InsuranceOptionCodeType.NotOffered;
                    InsuranceDetails.InsuranceOptionSpecified = true;
                    shippingDetails.InternationalInsuranceDetails = InsuranceDetails;
                    shippingDetails.InsuranceDetails = InsuranceDetails;

                    #endregion

                    #region Internation 1
                    st2 = new InternationalShippingServiceOptionsType();
                    st2.ShippingService = "OtherInternational";
                    st2.ShippingServiceAdditionalCost = new AmountType();
                    st2.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.USD;
                    st2.ShippingServiceAdditionalCost.Value = 0;

                    st2.ShippingServiceCost = new AmountType();
                    st2.ShippingServiceCost.currencyID = CurrencyCodeType.USD;
                    st2.ShippingServiceCost.Value = 0;

                    st2.ShippingInsuranceCost = new AmountType();
                    st2.ShippingInsuranceCost.currencyID = CurrencyCodeType.USD;
                    st2.ShippingInsuranceCost.Value = 0;
                    st2.ShippingServicePriority = 1;

                    st2.ShipToLocation = new StringCollection(new string[] { "Worldwide" });
                    shippingDetails.InternationalShippingServiceOption.Add(st2);

                    #endregion

                    shippingDetails.PaymentInstructions = "";

                    i1.ShippingDetails = shippingDetails;
                    i1.ShippingDetails.ExcludeShipToLocation = new StringCollection();
                    i1.ShippingDetails.SellerExcludeShipToLocationsPreference = false;
                    i1.ShippingDetails.SellerExcludeShipToLocationsPreferenceSpecified = true;
                    i1.ShippingDetails.PaymentInstructions = "Payment is expect to be paid within 7 days after auction ends. ";
                    i1.DispatchTimeMax = 2;
                    i1.DispatchTimeMaxSpecified = true;

                    i1.Country = CountryCodeType.CN;
                    i1.CountrySpecified = true;
                    i1.Location = "fast shipping shanghai";





                    #endregion
                    break;

                case "US_SHANGHAI_D(2)_I(2)":

                    #region US_SHANGHAI_D(2)_I(2)

                    shippingDetails = new ShippingDetailsType(); ;

                    shippingDetails.ShippingType = ShippingTypeCodeType.Flat;
                    shippingDetails.ShippingTypeSpecified = true;
                    shippingDetails.ShippingRateTypeSpecified = true;

                    shippingDetails.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection();
                    shippingDetails.InternationalShippingServiceOption = new InternationalShippingServiceOptionsTypeCollection();

                    #region Domestic 1
                    st1 = new ShippingServiceOptionsType();
                    st1.ShippingService = "EconomyShippingFromOutsideUS";

                    st1.ShippingServiceCost = new AmountType();
                    st1.ShippingServiceCost.currencyID = CurrencyCodeType.USD;
                    st1.ShippingServiceCost.Value = 2;
                    st1.FreeShipping = false;
                    st1.FreeShippingSpecified = false;

                    st1.ShippingServiceAdditionalCost = new AmountType();
                    st1.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.USD;
                    st1.ShippingServiceAdditionalCost.Value = 0;

                    st1.ShippingInsuranceCost = new AmountType();
                    st1.ShippingInsuranceCost.Value = 0;
                    st1.ShippingInsuranceCost.currencyID = CurrencyCodeType.USD;

                    st1.ShippingServicePriority = 0;
                    shippingDetails.ShippingServiceOptions.Add(st1);

                    InsuranceDetails = new InsuranceDetailsType();
                    InsuranceDetails.InsuranceFee = new AmountType();
                    InsuranceDetails.InsuranceFee.currencyID = CurrencyCodeType.USD;
                    InsuranceDetails.InsuranceFee.Value = 0;
                    InsuranceDetails.InsuranceOption = InsuranceOptionCodeType.NotOffered;
                    InsuranceDetails.InsuranceOptionSpecified = true;
                    shippingDetails.InternationalInsuranceDetails = InsuranceDetails;
                    shippingDetails.InsuranceDetails = InsuranceDetails;

                    #endregion

                    #region Internation 1
                    st2 = new InternationalShippingServiceOptionsType();
                    st2.ShippingService = "OtherInternational";
                    st2.ShippingServiceAdditionalCost = new AmountType();
                    st2.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.USD;

                    st2.ShippingServiceCost = new AmountType();
                    st2.ShippingServiceCost.currencyID = CurrencyCodeType.USD;
                    st2.ShippingServiceCost.Value = 2;
                    st2.ShippingServiceAdditionalCost.Value = 0;

                    st2.ShippingInsuranceCost = new AmountType();
                    st2.ShippingInsuranceCost.currencyID = CurrencyCodeType.USD;
                    st2.ShippingInsuranceCost.Value = 0;
                    st2.ShippingServicePriority = 1;

                    st2.ShipToLocation = new StringCollection(new string[] { "Worldwide" });
                    shippingDetails.InternationalShippingServiceOption.Add(st2);

                    #endregion

                    shippingDetails.PaymentInstructions = "";

                    i1.ShippingDetails = shippingDetails;
                    i1.ShippingDetails.ExcludeShipToLocation = new StringCollection();
                    i1.ShippingDetails.SellerExcludeShipToLocationsPreference = false;
                    i1.ShippingDetails.SellerExcludeShipToLocationsPreferenceSpecified = true;
                    i1.ShippingDetails.PaymentInstructions = "Payment is expect to be paid within 7 days after auction ends. ";
                    i1.DispatchTimeMax = 2;
                    i1.DispatchTimeMaxSpecified = true;

                    i1.Country = CountryCodeType.CN;
                    i1.CountrySpecified = true;
                    i1.Location = "fast shipping shanghai";





                    #endregion
                    break;
                 case "UK_SHANGHAI_D(0)_I(0)":

                    #region UK_SHANGHAI_D(0)_I(0)

                    shippingDetails = new ShippingDetailsType(); ;

                    shippingDetails.ShippingType = ShippingTypeCodeType.Flat;
                    shippingDetails.ShippingTypeSpecified = true;
                    shippingDetails.ShippingRateTypeSpecified = true;

                    shippingDetails.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection();
                    shippingDetails.InternationalShippingServiceOption = new InternationalShippingServiceOptionsTypeCollection();

                    #region Domestic 1
                    st1 = new ShippingServiceOptionsType();
                    st1.ShippingService = "UK_EconomyShippingFromOutside";

                    st1.ShippingServiceCost = new AmountType();
                    st1.ShippingServiceCost.currencyID = CurrencyCodeType.GBP;
                    st1.ShippingServiceCost.Value = 0;
                    st1.FreeShipping = true;
                    st1.FreeShippingSpecified = true;

                    st1.ShippingServiceAdditionalCost = new AmountType();
                    st1.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.GBP;
                    st1.ShippingServiceAdditionalCost.Value = 0;

                    st1.ShippingInsuranceCost = new AmountType();
                    st1.ShippingInsuranceCost.Value = 0;
                    st1.ShippingInsuranceCost.currencyID = CurrencyCodeType.GBP;

                    st1.ShippingServicePriority = 0;
                    shippingDetails.ShippingServiceOptions.Add(st1);

                    InsuranceDetails = new InsuranceDetailsType();
                    InsuranceDetails.InsuranceFee = new AmountType();
                    InsuranceDetails.InsuranceFee.currencyID = CurrencyCodeType.GBP;
                    InsuranceDetails.InsuranceFee.Value = 0;
                    InsuranceDetails.InsuranceOption = InsuranceOptionCodeType.NotOffered;
                    InsuranceDetails.InsuranceOptionSpecified = true;
                    shippingDetails.InternationalInsuranceDetails = InsuranceDetails;
                    shippingDetails.InsuranceDetails = InsuranceDetails;

                    #endregion

                    #region Internation 1
                    st2 = new InternationalShippingServiceOptionsType();
                    st2.ShippingService = "UK_OtherCourierOrDeliveryInternational";
                    st2.ShippingServiceAdditionalCost = new AmountType();
                    st2.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.GBP;
                    st2.ShippingServiceAdditionalCost.Value = 0;

                    st2.ShippingServiceCost = new AmountType();
                    st2.ShippingServiceCost.currencyID = CurrencyCodeType.GBP;
                    st2.ShippingServiceCost.Value = 0;

                    st2.ShippingInsuranceCost = new AmountType();
                    st2.ShippingInsuranceCost.currencyID = CurrencyCodeType.GBP;
                    st2.ShippingInsuranceCost.Value = 0;
                    st2.ShippingServicePriority = 1;

                    st2.ShipToLocation = new StringCollection(new string[] { "Worldwide" });
                    shippingDetails.InternationalShippingServiceOption.Add(st2);

                    #endregion

                    shippingDetails.PaymentInstructions = "";

                    i1.ShippingDetails = shippingDetails;
                    i1.ShippingDetails.ExcludeShipToLocation = new StringCollection();
                    i1.ShippingDetails.SellerExcludeShipToLocationsPreference = false;
                    i1.ShippingDetails.SellerExcludeShipToLocationsPreferenceSpecified = true;
                    i1.ShippingDetails.PaymentInstructions = "Payment is expect to be paid within 7 days after auction ends. ";
                    i1.DispatchTimeMax = 2;
                    i1.DispatchTimeMaxSpecified = true;

                    i1.Country = CountryCodeType.HK;
                    i1.CountrySpecified = true;
                    i1.Location = "fast shipping shanghai";





                    #endregion
                    break;

                 case "UK_SHANGHAI_D(2)_I(2)":

                    #region UK_SHANGHAI_D(2)_I(2)

                    shippingDetails = new ShippingDetailsType(); ;

                    shippingDetails.ShippingType = ShippingTypeCodeType.Flat;
                    shippingDetails.ShippingTypeSpecified = true;
                    shippingDetails.ShippingRateTypeSpecified = true;

                    shippingDetails.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection();
                    shippingDetails.InternationalShippingServiceOption = new InternationalShippingServiceOptionsTypeCollection();

                    #region Domestic 1
                    st1 = new ShippingServiceOptionsType();
                    st1.ShippingService = "UK_EconomyShippingFromOutside";

                    st1.ShippingServiceCost = new AmountType();
                    st1.ShippingServiceCost.currencyID = CurrencyCodeType.GBP;
                    st1.ShippingServiceCost.Value = 2;
                    //st1.FreeShipping = true;
                    //st1.FreeShippingSpecified = true;

                    st1.ShippingServiceAdditionalCost = new AmountType();
                    st1.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.GBP;
                    st1.ShippingServiceAdditionalCost.Value = 0;

                    st1.ShippingInsuranceCost = new AmountType();
                    st1.ShippingInsuranceCost.Value = 0;
                    st1.ShippingInsuranceCost.currencyID = CurrencyCodeType.GBP;

                    st1.ShippingServicePriority = 0;
                    shippingDetails.ShippingServiceOptions.Add(st1);

                    InsuranceDetails = new InsuranceDetailsType();
                    InsuranceDetails.InsuranceFee = new AmountType();
                    InsuranceDetails.InsuranceFee.currencyID = CurrencyCodeType.GBP;
                    InsuranceDetails.InsuranceFee.Value = 0;
                    InsuranceDetails.InsuranceOption = InsuranceOptionCodeType.NotOffered;
                    InsuranceDetails.InsuranceOptionSpecified = true;
                    shippingDetails.InternationalInsuranceDetails = InsuranceDetails;
                    shippingDetails.InsuranceDetails = InsuranceDetails;

                    #endregion

                    #region Internation 1
                    st2 = new InternationalShippingServiceOptionsType();
                    st2.ShippingService = "UK_OtherCourierOrDeliveryInternational";
                    st2.ShippingServiceAdditionalCost = new AmountType();
                    st2.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.GBP;
                    st2.ShippingServiceAdditionalCost.Value = 0;

                    st2.ShippingServiceCost = new AmountType();
                    st2.ShippingServiceCost.currencyID = CurrencyCodeType.GBP;
                    st2.ShippingServiceCost.Value = 2;

                    st2.ShippingInsuranceCost = new AmountType();
                    st2.ShippingInsuranceCost.currencyID = CurrencyCodeType.GBP;
                    st2.ShippingInsuranceCost.Value = 0;
                    st2.ShippingServicePriority = 1;

                    st2.ShipToLocation = new StringCollection(new string[] { "Worldwide" });
                    shippingDetails.InternationalShippingServiceOption.Add(st2);

                    #endregion

                    shippingDetails.PaymentInstructions = "";

                    i1.ShippingDetails = shippingDetails;
                    i1.ShippingDetails.ExcludeShipToLocation = new StringCollection();
                    i1.ShippingDetails.SellerExcludeShipToLocationsPreference = false;
                    i1.ShippingDetails.SellerExcludeShipToLocationsPreferenceSpecified = true;
                    i1.ShippingDetails.PaymentInstructions = "Payment is expect to be paid within 7 days after auction ends. ";
                    i1.DispatchTimeMax = 2;
                    i1.DispatchTimeMaxSpecified = true;

                    i1.Country = CountryCodeType.HK;
                    i1.CountrySpecified = true;
                    i1.Location = "fast shipping shanghai";





                    #endregion
                    break;

                default:
                    break;
            }

        }
    }
}
